<?php require_once("functions.php"); ?>
<?php require("db_anslutning.php"); ?>
<?php include("header.php"); ?>

<?php
	
	/*  We call this function and all it does is to set the value of the
	selected link and compare this value to the database. Then we put this
	data (array) in the variable $sel_subject or $sel_page. Since those
	variables are globals we can reach them from outside the function. 
	*/
	
	find_selected_page();

?>	
	<div id="header">
	<h2>Daniel Jansson</h2>	
	</div>
	
	<div>
	<table id="tablesize">
		<tr>
			<td id="navigation">

<?php echo navigation($sel_subject, $sel_page); ?>
<ul><a href="new_subject.php">+ Nytt &auml;mne</a></ul>

	</td>
	<td id="content">

<?php 	
		/* Checks which of the two variables that is not NULL, that
		means wich variable ($sel_subject or $sel_page that contains
		someting, a value) and echoes a string for that variable The
		variable that contains a value is the one that has been sent
		to the function get_"$var"_by_id above, and the function has
		returned av value. */
		
		if (!is_null($sel_subject)) { echo "<h2>" . $sel_subject['menu_name'] . "</h2>"; } // subject selected 
		elseif (!is_null($sel_page)) { echo "<h2>" . $sel_page['menu_name'] . "</h2>"; } // page selected
		else { echo "<h2>V&auml;lj ett &auml;mne eller en sida att redigera</h2>"; }
		
?>
		
		</td>
	  </tr>
	</table>
  </div>
<?php require("sidfot.php"); ?>